package data 
{
	import com.GCQuest;
	import flash.utils.Dictionary;
	/**
	 * ...
	 * @author Jason Won
	 */
	public class GCQuestData 
	{
		
		
		/*
		 * This list will map out how much experience is need for a player to reach
		 * the next fame level.
		 */
		public static var _experienceSequence:Vector.<uint>;
		
		
		
		// Template IDs
		public static const QUEST_TEMPLATE_000:uint = 0;
		public static const QUEST_TEMPLATE_001:uint = 1;
		public static const QUEST_TEMPLATE_002:uint = 2;
		public static const QUEST_TEMPLATE_003:uint = 3;
		public static const QUEST_TEMPLATE_004:uint = 4;
		public static const QUEST_TEMPLATE_005:uint = 5;
		public static const QUEST_TEMPLATE_006:uint = 6;
		public static const QUEST_TEMPLATE_007:uint = 7;
		public static const QUEST_TEMPLATE_008:uint = 8;
		public static const QUEST_TEMPLATE_009:uint = 9;
		public static const QUEST_TEMPLATE_010:uint = 10;
		public static const QUEST_TEMPLATE_011:uint = 11;
		public static const QUEST_TEMPLATE_012:uint = 12;
		
		// Tutorial Quest Templates
		public static const QUEST_TEMPLATE_TUTORIAL_0:uint = 1000;
		public static const QUEST_TEMPLATE_TUTORIAL_1:uint = 1001;
		public static const QUEST_TEMPLATE_TUTORIAL_2:uint = 1002;
		public static const QUEST_TEMPLATE_TUTORIAL_3:uint = 1003;
		public static const QUEST_TEMPLATE_TUTORIAL_4:uint = 1004;
		public static const QUEST_TEMPLATE_TUTORIAL_5:uint = 1005;
		public static const QUEST_TEMPLATE_TUTORIAL_6:uint = 1006;
		public static const QUEST_TEMPLATE_TUTORIAL_7:uint = 1007;
		public static const QUEST_TEMPLATE_TUTORIAL_8:uint = 1008;
		public static const QUEST_TEMPLATE_TUTORIAL_9:uint = 1009;
		public static const QUEST_TEMPLATE_TUTORIAL_10:uint = 1010;
		public static const QUEST_TEMPLATE_TUTORIAL_11:uint = 1011;
		public static const QUEST_TEMPLATE_TUTORIAL_12:uint = 1012;
		public static const QUEST_TEMPLATE_TUTORIAL_13:uint = 1013;
		public static const QUEST_TEMPLATE_TUTORIAL_14:uint = 1014;
		public static const QUEST_TEMPLATE_TUTORIAL_15:uint = 1015;
		public static const QUEST_TEMPLATE_TUTORIAL_16:uint = 1016;
		public static const QUEST_TEMPLATE_TUTORIAL_17:uint = 1017;
		public static const QUEST_TEMPLATE_TUTORIAL_18:uint = 1018;
		public static const QUEST_TEMPLATE_TUTORIAL_19:uint = 1019;
		
		// Store a string description for each template
		public static var _questTemplateTutorialDesc:Dictionary;
		
		// Assigner IDs
		public static const ASSIGNER_OWEN:uint = 		1;
		public static const ASSIGNER_ROY:uint = 		2;
		public static const ASSIGNER_STERLING:uint =	3;
		public static const ASSIGNER_JASON:uint = 		4;
		
		// Quest Type IDs
		public static const QUEST_TYPE_NPCORDER:uint = 0;
		public static const QUEST_TYPE_TUTORIAL:uint = 1;
		public static const QUEST_TYPE_TUTORIAL_ORDER:uint = 2;
		
		// Stores the information about quests
		public static var _information:Dictionary;
		
		
		public static function initialize():void
		{
			_information = new Dictionary();
			var name:String;
			var type:uint;
			var description:String;
			var questStruct:GCQuestDataStruct;
			
			/** Exclusively used for regular NPC orders **/
			// Fill the quest information into the dictionary			
			name = "Gather items";
			type = QUEST_TYPE_NPCORDER;
			description = "A new customer order has just come in!";
			_information[QUEST_TEMPLATE_000] = new GCQuestDataStruct(name, type, description);
			
			name = "Build item";
			type = QUEST_TYPE_NPCORDER;
			description = "Provide the customer with the required goods!";
			_information[QUEST_TEMPLATE_001] = new GCQuestDataStruct(name, type, description);
			
			/*
			 * Fill in the text for each tutorial template, this text shows on completion.
			 */
			_questTemplateTutorialDesc = new Dictionary();
			var qttDesc:String;
			qttDesc = "Congratulations, your items have been bought! Remember other traders are more likely to buy your goods if you post a reasonable price." + 
						"Successfully selling goods gives you XP as well!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_0] = qttDesc;
			
			qttDesc = "Good work you have enough lumber to give to the customer! Just like selling, buying goods from others gives " +
						"XP!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_1] = qttDesc;
			
			qttDesc = "You have fulfilled your first customer order. Orders are a great way to earn more gold. They even give a little bit of XP, but " +
						"not as much as buying and selling.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_2] = qttDesc;
			
			qttDesc = "You have enough food to travel. Remember that travelling costs some resources, which must be present in your ship inventory before " +
						" you can set sail!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_3] = qttDesc;
			
			qttDesc = "Nicely done, you have enough iron. It has automatically been put into your ship inventory.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_4] = qttDesc;
			
			qttDesc = "You have reached Tafferel! The food required to travel gets automatically been removed from your ship. " +
						"A new list of tasks have been posted, enter the city to finish them.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_5] = qttDesc;
			
			qttDesc = "You have fulfilled another order! Remember, orders from different cities require docking your ship at that city before being " +
						"able to turn in.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_6] = qttDesc;
			
			qttDesc = "Great work! Markets in different cities may have drastically different prices and items. It may be prudent to shop around " +
						"to see if other players are selling goods you need at a cheap price!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_7] = qttDesc;
			
			qttDesc = "Welcome back to Picaroon. New tasks and orders are available for you for you to complete!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_8] = qttDesc;
			
			qttDesc = "Don't worry if you do not complete an order in time! There is no penalty, although if you don't finish an order in time, any resources " +
						"you contributed to that order are lost.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_9] = qttDesc;
			
			qttDesc = "Nicely done! Remember you can only sell goods that are stored inside the city warehouse. You can also remove your sales if you find that " +
						"no one is buying them within the market.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_10] = qttDesc;
			
			qttDesc = "In order to sell items at this city, you must move them from your ship to your warehouse!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_18] = qttDesc;
			
			qttDesc = GCExperienceData.EXP_THIRD_LEVEL_UP;
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_11] = qttDesc;
			
			qttDesc = "Congratulations, you have built a farm! The next step is assigning workers to them so you can produce your own food.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_12] = qttDesc;
			
			qttDesc = "Good job! Workers will gather resources over time and automatically put them in your warehouse. More workers at a building means they harvest at a greater rate!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_13] = qttDesc;
			
			qttDesc = "You are now creating your own food. Harvested resources will accumulate in the city warehouse over time.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_17] = qttDesc;
			
			qttDesc = "Congratulations, you have built a warehouse! Remember warehouses are first structure you should build at a city since they allow you to store goods, harvest " +
						" resources, and sell goods at that city! Be careful they only have a limited capacity.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_14] = qttDesc;
			
			qttDesc = "You have synthesized your first item. As you play you may find recipes given to you as a reward or available for purchase at a market. Now take the upgrade and " +
						"put it on your ship.";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_15] = qttDesc;
			
			qttDesc = "Congratulations, you have applied you first upgrade. Travelling to other cities have certain stat requirements on your ship, by applying more upgrades " +
						"you can unlock new areas to travel to!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_16] = qttDesc;
			
			qttDesc = "Keep a look out for more recipes and upgrades, they may show up in the market or as rewards for completing orders! You'll need them " +
						"to travel to other cities!";
			_questTemplateTutorialDesc[QUEST_TEMPLATE_TUTORIAL_19] = qttDesc;
			
			name = "Sell";
			type = QUEST_TYPE_TUTORIAL;
			description = "Your first step to building your trading empire is getting some gold." +
						"Go to the market and sell enough goods to make 200 gold. Once you post all your sales, exit " +
						"and wait for someone to buy your wares!";
			questStruct = new GCQuestDataStruct(name, type, description, 45);
			_information[QUEST_TEMPLATE_TUTORIAL_0] = questStruct;
			
			name = "Buy items";
			type = QUEST_TYPE_TUTORIAL;
			description = "Often times you'll need to buy goods from other trader. Go out and buy 10 lumber from" +
						" the market. You can use this to fulfill the customer order!";
			questStruct = new GCQuestDataStruct(name, type, description, 45, GCQuest.FALSE);
			_information[QUEST_TEMPLATE_TUTORIAL_1] = questStruct;
			
			name = "First Order";
			type = QUEST_TYPE_TUTORIAL_ORDER;
			description = "Give customers the specified amount and they will offer a reward for finishing the order! " +
					"Hint: Buy the needed items from the market.";
			questStruct = new GCQuestDataStruct(name, type, description, 11);
			_information[QUEST_TEMPLATE_TUTORIAL_2] = questStruct;
			
			name = "Ship journey cost";
			type = QUEST_TYPE_TUTORIAL;
			description = "Traveling to other cities cost some resources. The journey to Tafferel will require having " +
						" food. Go to the market and purchase at least 10 food. You can check how much food you have onboard " +
						"your ship by going to the inventory option!";
			questStruct = new GCQuestDataStruct(name, type, description, 50, GCQuest.FALSE);
			_information[QUEST_TEMPLATE_TUTORIAL_3] = questStruct;
			
			name = "Ship journey sell";
			type = QUEST_TYPE_TUTORIAL;
			description = "Customer orders may appear from different cities, you will need to sail there to fulfill them. There is a " +
						"demand for iron at Tafferel. Purchase 5 iron from the market before you sail.";
			questStruct = new GCQuestDataStruct(name, type, description, 40, GCQuest.FALSE);
			_information[QUEST_TEMPLATE_TUTORIAL_4] = questStruct;
			
			name = "Ship journey travel";
			type = QUEST_TYPE_TUTORIAL;
			description = "Set sail to Tafferel! First you will need some goods loaded onto your ship.\nHint: " +
						"Go to the market and buy at least 5 food and 5 iron.";
			questStruct = new GCQuestDataStruct(name, type, description, 20);
			_information[QUEST_TEMPLATE_TUTORIAL_5] = questStruct;
			
			name = "Outside order";
			type = QUEST_TYPE_TUTORIAL_ORDER;
			description = "A customer from Tafferel has asked for goods from you!";
			questStruct = new GCQuestDataStruct(name, type, description, 20);
			_information[QUEST_TEMPLATE_TUTORIAL_6] = questStruct;
			
			name = "Purchase other goods at city";
			type = QUEST_TYPE_TUTORIAL;
			description = "Cotton in this market seems to be very cheap. Buy 15 units at this market to take back with you";
			questStruct = new GCQuestDataStruct(name, type, description, 50);
			_information[QUEST_TEMPLATE_TUTORIAL_7] = questStruct;
			
			name = "Return to Picaroon";
			type = QUEST_TYPE_TUTORIAL;
			description = "When you have finished all other tasks in this city, set sail back to Picaroon.";
			questStruct = new GCQuestDataStruct(name, type, description, 0);
			_information[QUEST_TEMPLATE_TUTORIAL_8] = questStruct;
			
			name = "First timed order";
			type = QUEST_TYPE_TUTORIAL_ORDER;
			description = "Customers are usually impatient, from now on you will only have a limited amount of time to complete them.";
			questStruct = new GCQuestDataStruct(name, type, description, 30);
			_information[QUEST_TEMPLATE_TUTORIAL_9] = questStruct;
			
			name = "Selling some more stuff";
			type = QUEST_TYPE_TUTORIAL;
			description = "Take the goods that you bought at Tafferel and post them on sale!";
			questStruct = new GCQuestDataStruct(name, type, description, 80);
			_information[QUEST_TEMPLATE_TUTORIAL_10] = questStruct;
			
			name = "Level up";
			type = QUEST_TYPE_TUTORIAL;
			description = "Try to reach the next fame level! Gain XP by selling goods and buying goods at the market or by fulfilling more orders!";
			questStruct = new GCQuestDataStruct(name, type, description, 0);
			_information[QUEST_TEMPLATE_TUTORIAL_11] = questStruct;
			
			name = "Load and Unload ship";
			type = QUEST_TYPE_TUTORIAL;
			description = "Load and unload goods from ship to sell.";
			questStruct = new GCQuestDataStruct(name, type, description, 0 ,GCQuest.FALSE);
			_information[QUEST_TEMPLATE_TUTORIAL_18] = questStruct;
			
			name = "Construct a Farm";
			type = QUEST_TYPE_TUTORIAL;
			description = "Build a farm so you can produce your own food. In the city menu, select the option to construct new buildings and pick the " +
						"farm. Make sure you have enough gold to build it!";
			questStruct = new GCQuestDataStruct(name, type, description, 70, GCQuest.FALSE);
			_information[QUEST_TEMPLATE_TUTORIAL_12] = questStruct;
			
			name = "Assign workers";
			type = QUEST_TYPE_TUTORIAL;
			description = "Put your new crew to work! In order for your harvest buildings to produce any resources you will need to assign workers " +
						"to them. Go to the assign jobs option in the city and assign all three workers to the farm.";
			questStruct = new GCQuestDataStruct(name, type, description, 50, GCQuest.FALSE);
			_information[QUEST_TEMPLATE_TUTORIAL_13] = questStruct;
			
			name = "Gather food";
			type = QUEST_TYPE_TUTORIAL;
			description = "It is time to gather your own resources! You will need to: \n-Build a farm\n-Assign 3 workers to the farm\n-Have your workers " +
						"gather at least 3 food";
			questStruct = new GCQuestDataStruct(name, type, description, 50);
			_information[QUEST_TEMPLATE_TUTORIAL_17] = questStruct;
			
			name = "Build Warehouse";
			type = QUEST_TYPE_TUTORIAL;
			description = "Expand your trading to other cities. In order to sell items or gather resources at other cities, you first need to " +
						"build a warehouse! Sail to another city and build a warehouse.";
			questStruct = new GCQuestDataStruct(name, type, description, 100);
			_information[QUEST_TEMPLATE_TUTORIAL_14] = questStruct;
			
			name = "Synthesize Recipe";
			type = QUEST_TYPE_TUTORIAL;
			description = "Recipes are used to produce poweful new items, go to the synthesize option in the ship and find out what ingredients you need to make " +
						"the item!";
			questStruct = new GCQuestDataStruct(name, type, description, 150, GCQuest.FALSE);
			_information[QUEST_TEMPLATE_TUTORIAL_15] = questStruct;
			
			name = "Put on Upgrade";
			type = QUEST_TYPE_TUTORIAL;
			description = "In order to sail to other cities, you'll need to upgrade your ship. New options in the ship menu to create upgrades and and apply them " +
				"have been unlocked.\nYou'll need to synthesize an upgrade and put it on your ship!";
			questStruct = new GCQuestDataStruct(name, type, description, 150);
			_information[QUEST_TEMPLATE_TUTORIAL_16] = questStruct;
			
			name = "Apply Upgrade Goal";
			type = QUEST_TYPE_TUTORIAL;
			description = "You'll need to upgrade your ship to sail to some cities. New options in the ship menu to create upgrades and and apply them " +
						"have been unlocked. Use them to get your first upgrade!";
			questStruct = new GCQuestDataStruct(name, type, description, 50);
			_information[QUEST_TEMPLATE_TUTORIAL_19] = questStruct;
		}
		
		public static function getNameFromId(id:uint):String
		{
			return (_information[id] as GCQuestDataStruct).name;
		}
		
		public static function getTypeFromId(id:uint):uint
		{
			return (_information[id] as GCQuestDataStruct).type;
		}
		
		public static function getDescriptionFromId(id:uint):String
		{
			return (_information[id] as GCQuestDataStruct).description;
		}
		
		public static function getTutorialDescriptionFromId(id:uint):String
		{
			return _questTemplateTutorialDesc[id];
		}
		
		public static function getTutorialVisibilityFromId(id:uint):uint
		{
			return (_information[id] as GCQuestDataStruct).visibility;
		}
		
		public static function getTutorialExperienceFromId(id:uint):uint
		{
			return (_information[id] as GCQuestDataStruct).xp;
		}
	}

}